package main

import (
	"log"

	"flag"

	"tdull.com/file-sync/src/dav"
)

func main() {

	var dav_url string

	var dav_username string
	var dav_password string

	var local_path string
	var dav_path string

	var del_flag bool
	flag.StringVar(&dav_url, "w", "", "WEBDAV路径")
	flag.StringVar(&dav_username, "u", "", "用户名")
	flag.StringVar(&dav_password, "p", "", "密码")

	flag.StringVar(&local_path, "lp", "", "本地路径")
	flag.StringVar(&dav_path, "dp", "", "本地路径")

	flag.BoolVar(&del_flag, "f", false, "删除标志")
	flag.Parse()
	log.Printf("WEBDAV路径: %t", del_flag)
	if local_path == "" {
		log.Println("请指定本地路径 -h")
		return
	}
	log.Println("本地路径:" + local_path)

	davSync := dav.New(dav_url, dav_username, dav_password)
	davSync.Del_flag = del_flag
	davSync.Sync(local_path, dav_path)
}
